package com.company.ThreadDemo;

public class JoinDemo implements Runnable{

    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println("VIP线程执行");
        }
    }

    public static void main(String[] args) throws InterruptedException {
        JoinDemo joinDemo = new JoinDemo();
        Thread thread = new Thread(joinDemo);
         thread.start();

        for (int i = 0; i < 300; i++) {
              if(i==200){
                   thread.join();
              }
            System.out.println("main线程执行");
        }
    }
}
